// main.cpp
#include "UserManager.h"
#include "DeviceManager.h"
#include "Logger.h"
#include "ThreadPool.h"
int main() {
    try {
        // 初始化组件
        //Database::getInstance().connect("smart_home.db");
        Database::getInstance().initialize("smart_home.db");
        Logger::init("logs.txt");
        ThreadPool pool(4);
        // 创建管理类实例
        UserManager userManager;
        DeviceManager deviceManager(pool);
        
        // 示例：用户登录
        auto session = userManager.login("admin", "admin123");
        if (session.isValid()) {
            // 示例：设备操作
            auto device = deviceManager.getDevice(1);
            device->setBrightness(75);
        }
        
        // 清理资源
        pool.shutdown();
        Database::getInstance().disconnect();
    } catch (const std::exception& e) {
        Logger::logError(e.what());
    }
    return 0;
}
